{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1415
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	k,tt,ls,i:longint;
	s:string;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(s);
read(k);
ls:=length(s);
for i:=1 to ls do begin
	tt:=ord(s[i])-k;
	if tt<65 then inc(tt,26);
	write(chr(tt));
end;
end.